<div class="boxed">
    <div id="content-container">
        <div id="page-title">
            <h1 class="page-header text-overflow">Data Tables</h1>
            <div class="searchbox">
                <div class="input-group custom-search-form">
                    <input type="text" class="form-control" placeholder="Search..">
                    <span class="input-group-btn">
                        <button class="text-muted" type="button"><i class="demo-pli-magnifi-glass"></i></button>
                    </span>
                </div>
            </div>
        </div>
        <div id="page-content">
            <div class="col-sm-12">
                <div class="panel">
                    <div class="panel-heading">
                        <h3 class="panel-title">
                            新增首页BANNER
                        </h3>
                    </div>
                    <form class="form-horizontal" method="post">
                        <div class="panel-body">
                            <textarea placeholder="Message" rows="20"
                                      class="form-control"
                                      id="textarea">{$bannerSet}</textarea>
                            <iframe name="myFrame" id="editor" onload="iframeLoad()" src="/index.php/Admin/editor"></iframe>
                        </div>
                        <div class="panel-footer">
                            <div class="">
                                <button class="btn btn-warning" type="reset" onclick="hst()">格式化查看</button>
                                <button class="btn btn-mint" type="submit">提交数据</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    var flag = true;
    var olddata = '';
    function hst() {
        if(flag){
            var originalJson = $('#textarea').text();
            olddata = originalJson;
            var resultJson = formatJson(originalJson);
        }else{
            resultJson = olddata;
        }
        //(3)将格式化好后的json写入页面中
        document.getElementById("textarea").innerHTML =  resultJson;
        flag = !flag;
    }
    function iframeLoad() {
        myFrame.window.editorGetData(`{$bannerSet}`)
    }
    function EditorInit() {
        console.log('EditorInit');
    }
</script>